package zhyh.kit.convert;

import java.math.BigDecimal;

import zhyh.exception.UnSupportTypeException;

public class MyConvertKit
{

	public static Object convertFromDouble(Double source, String typeName) {
		if ("java.lang.Double".equals(typeName)) {
			return source;
		} else if ("java.lang.Integer".equals(typeName)) {
			return source.intValue();
		} else if ("java.math.BigDecimal".equals(typeName)) {
			new BigDecimal(source);
		} else if ("java.lang.Long".equals(typeName)) {
			source.longValue();
		} else {
			throw new UnSupportTypeException("暂不支持此数字类型转换：" + typeName);
		}
		return source;
	}
}
